if first char of theaddr is not "0" then exit repeat
delete first char of theaddr
end repeat
put theaddr into card field "address"
end mouseUp
-- part 2 (field)
-- low flags: 00
-- high flags: 2004
-- rect: left=121 top=282 right=305 bottom=218
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: word
----- HyperTalk script -----
on returninfield
click at loc of card button "Trap Address"
end returninfield
on enterinfield
end enterinfield
-- part 3 (field)
-- low flags: 01
-- high flags: 2004
-- rect: left=225 top=282 right=305 bottom=323
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: address
-- part contents for background part 68
----- text -----
TrapAdr is an XFCN that takes the trap word of a given toolbox trap and returns the address of the trap in memory. It uses the toolbox NGetTrapAddress to perform its action. Note that this XFCN expects the entire trap word of the trap and not just the trap number. For example, the trap word for GetNextEvent is A970 while the trap number is 170. Read about the trap mechanism in Inside Macintosh for more details. Try the Demo below to clarify any uncertainties you may have about this XFCN.